<template>
  <PagingTable ref="pagingTable" :options="options" :querys="querys">
    <template slot="filter-content">
      <el-input  v-model="querys.name" placeholder="搜索科目名称" style="width: 200px;" class="filter-item" />
    </template>

    <template slot="data-columns">

      <el-table-column label="科目名称" >

        <template slot-scope="data">

          <router-link :to="{ name: 'SubjectForm', params:{id: data.row.id}}">
            {{ data.row.name }}
          </router-link>

        </template>

      </el-table-column>

      <el-table-column :width="150" label="操作" align="center" >
          <template slot-scope="scope">
            <el-button icon="el-icon-caret-right" type="primary" size="mini" @click="handlePaper(scope.row)">编辑试卷</el-button>
          </template>
      </el-table-column>
    </template>
  </PagingTable>

</template>

<script>
import PagingTable from '@/components/PagingTable'

export default {
  name: 'SubjectList',
  components: { PagingTable },
  data() {
    return {

      querys: { name: '' },

      options: {
        controllerUrl: '/subject', // 列表请求URL
        addRoute: 'SubjectNew' // 添加数据路由
      }
    }
  },
  methods: {
    handlePaper(row){
      this.$router.push({ name: 'SubjectPaper', params: {
        id: row.id, name: row.name
      } })
    }
  }
}
</script>

<style>
.filter-content{
  justify-content: left;
}
</style>